package com.bjb.vr.operation.controller;

import com.bjb.vr.common.ao.UmsRoleAo;
import com.bjb.vr.common.result.BaseResult;
import com.bjb.vr.common.result.CommonResult;
import com.bjb.vr.common.service.UmsOptMenuService;
import com.bjb.vr.common.vo.MenuData;
import com.bjb.vr.common.vo.UmsMenuVo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @description:
 * @author: hujingbo
 * @create: 2022-08-23 08:24
 **/
@RestController
@RequestMapping("/api/operation/v1")
public class SysMenuController {

    @Resource
    private UmsOptMenuService umsOptMenuService;

    /**
     * 查询首页
     *
     * @return
     */
    @PostMapping("/queryHomePage")
    public BaseResult queryHomePage() {
        List<MenuData> menuVoIPage = umsOptMenuService.queryHomePage();
        return CommonResult.Ok().setResult(menuVoIPage);
    }

    /**
     * 查询权限菜单
     *
     * @param umsRoleAo
     * @return
     */
    @PostMapping("/queryOptMenus")
    public BaseResult queryOptMenus(@RequestBody UmsRoleAo umsRoleAo) {
        List<MenuData> umsMenuVos = umsOptMenuService.queryMenus(umsRoleAo);
        return CommonResult.Ok().setResult(umsMenuVos);
    }
}
